home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
v cisle
/
sadanastroju
/
wot-20080519-fx.xpi
/
chrome
/
wot.jar
/
content
/
idn.js
< prev
next >
Wrap
Text File
|
2007-11-11
|
1KB
|
65 lines
/*
idn.js
Copyright © 2005, 2006, 2007 Against Intuition, Inc. <info@mywot.com>
*/
/* Provides a simple wrapper for nsIIDNService */
var wot_idn =
{
init: function()
{
try {
if (this.handle) {
return;
}
this.handle =
Components.classes["@mozilla.org/network/idn-service;1"].
getService(Components.interfaces.nsIIDNService);
window.addEventListener("unload", function(e) {
wot_idn.unload();
}, false);
} catch (e) {
dump("wot_idn.init: failed with " + e + "\n");
}
},
unload: function()
{
this.handle = null;
},
isidn: function(str)
{
try {
return this.handle.isACE(str);
} catch (e) {
dump("wot_idn.isidn: failed with " + e + "\n");
}
return false;
},
utftoidn: function(utf)
{
try {
return this.handle.convertUTF8toACE(utf);
} catch (e) {
dump("wot_idn.utftoidn: failed with " + e + "\n");
}
return null;
},
idntoutf: function(idn)
{
try {
return this.handle.convertACEtoUTF8(idn);
} catch (e) {
dump("wot_idn.idntoutf: failed with " + e + "\n");
}
return null;
}
};
wot_idn.init();